//
//  AFNetWorkRequestTool.h
//  TBNetworking_Example
//
//  Created by apple on 2018/8/8.
//  Copyright © 2018年 lzb. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BaseResquestModel.h"
#import "BaseResponseModel.h"
//结果block
typedef void(^sucessResponseBlock)(id response);
typedef void(^failResponseBlock)(NSError *error);
typedef void(^uploadProgressBlock)(NSProgress *uploadProgress);

@interface AFNetWorkRequestTool : NSObject

+ (AFNetWorkRequestTool *)shareInstance;

/**
 *  请求参数模型
 */
@property (nonatomic, strong,readonly) BaseResquestModel *resquestModel;

/**
 *  请求响应模型
 */
@property (nonatomic, strong,readonly) BaseResponseModel *responseModel;

#pragma mark - 请求Method

/**
 网路请求-请求方式是请求模型配置

 @param requestModel 请求模型
 @param responseClass 响应模型
 @param isRequireAnalysis 是否解析
 @param sucessBlock 成功
 @param failBlock 失败
 @return 请求请求任务
 */
- (NSURLSessionDataTask *)httpRequestWithModel:(BaseResquestModel *)requestModel
                             ResponseClass:(Class)responseClass
                         isRequireAnalysis:(BOOL)isRequireAnalysis
                            sucessResponse:(sucessResponseBlock)sucessBlock
                              failResponse:(failResponseBlock)failBlock;


/**
  网路请求

 @param requestModel 请求模型
 @param responseClass 响应模型
 @param isRequireAnalysis 是否解析
 @param method 请求方式设置
 @param sucessBlock 成功
 @param failBlock 失败
 @return 请求任务
 */
- (NSURLSessionDataTask *)httpRequestWithModel:(BaseResquestModel *)requestModel
                                 ResponseClass:(Class)responseClass
                             isRequireAnalysis:(BOOL)isRequireAnalysis
                             requestMehtod:(AFNetworkRequestMethod)method
                                sucessResponse:(sucessResponseBlock)sucessBlock
                                  failResponse:(failResponseBlock)failBlock;

- (NSURLSessionDataTask *)httpRequestWithModel:(BaseResquestModel *)requestModel
                                 ResponseClass:(Class)responseClass
                             isRequireAnalysis:(BOOL)isRequireAnalysis
                                 requestMehtod:(AFNetworkRequestMethod)method
                               uploadProgress:(uploadProgressBlock)progressBlock
                                sucessResponse:(sucessResponseBlock)sucessBlock
                                  failResponse:(failResponseBlock)failBlock;

@end
